<!-- 定期排查-手工选择弹窗 -->
<template>
	<view class="manual-container">
		<u-modal v-model="show" title="检查标准" @confirm="confirm" >
			<view class="slot-content">
				<uni-table ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据"
					@selection-change="selectionChange">
					<uni-tr>
						<uni-th width="30" align="center">序号</uni-th>
						<uni-th width="80" align="center">检查类别</uni-th>
						<uni-th  width="80" align="center">检查分类</uni-th>
						<uni-th  width="80" align="center">检查范围</uni-th>
						<uni-th  width="140" align="center">检查标准</uni-th>
						<uni-th  width="140" align="center">检查依据</uni-th>
					</uni-tr>
					<uni-tr v-for="(item, index) in tableData" :key="index">
						<uni-td>{{ index+ 1 }}</uni-td>
						<uni-td>
							<view class="name">{{ item.inspectionCategoryName }}</view>
						</uni-td>
						<uni-td align="center">{{ item.inspectionClassifyName }}</uni-td>

						<uni-td align="center">{{ item.inspectionScopeName }}</uni-td>
						<uni-td align="center">{{ item.inspectionStandard }}</uni-td>
						<uni-td align="center">{{ item.inspectionBasis }}</uni-td>
					</uni-tr>
				</uni-table>
				<view class="uni-pagination-box"><uni-pagination show-icon :page-size="queryForm.pageSize"
						:current="queryForm.pageNum" :total="total" @change="changeNum" /></view>
			</view>
		</u-modal>
	</view>
</template>
<script>
	import {
		searchStand
	} from "@/api/hiddenTrouble/periodShoot.js"
	export default {
		data() {
			return {
				show: false,
				//选中的数据的索引
				selectedIndexs: [],
				//选中数据
				selectDatas: [],
				tableData: [],
				queryForm: {
					// 每页数据量
					pageSize: 10,
					// 当前页
					pageNum: 1,
				},

				// 数据总量
				total: 0,
				loading: false,

			}
		},
		methods: {
			changeShow() {
				this.show = !this.show
			},
			// 确定按钮
			confirm() {
				this.$emit("manualCheck", this.selectDatas)
			},
			//取消按钮
	
			//改变分页的方法
			changeNum(val) {
				// console.log("获取分页", pageNum, pageSize)
				let {
					current
				} = val
				this.queryForm.pageNum = current
				this.getStandard()

			},
			//获取检查标准
			async getStandard() {
				this.localRes = uni.getStorageSync("userInfo")

				this.queryForm.categoryId = this.localRes.companyAccount
				//是否需要条件
				let res = await searchStand(this.queryForm)
				this.tableData = res.rows
				this.total = res.total
				console.log("ppppp", res)
			},
			// 多选
			selectionChange(e) {

				let arrList = []
				this.selectedIndexs = e.detail.index
				// 将数组中的值，作为table表格数组的下标来获取对应的当前行数据
				this.selectedIndexs.map(i => {
					arrList.push(this.tableData[i])
				})
				this.selectDatas = arrList

			},
		},
		mounted() {
			this.getStandard()
		}
	}
</script>
<style lang="scss" scoped>
	.manual-container {
		.u-mode-center-box{
			width: 100%;
		}
	}
</style>